package com.baizhi.controller;


import com.baizhi.entity.BzAdmin;
import com.baizhi.service.IBzAdminService;

import com.baizhi.vo.R;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;


import java.util.ArrayList;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author huiJie
 * @since 2021-08-25
 */
@RestController
@RequestMapping("/admin")
public class BzAdminController {
    @Autowired
    private IBzAdminService adminService;
    @GetMapping
    @PreAuthorize("hasAuthority('sys:schedule:run')")
    public R showPage(Integer pageNum,Integer pageSize){
        return R.ok(adminService.showPageAdmin(pageNum,pageSize));
    }
//    @GetMapping("login")
//    public R login(String username,String password){
//        QueryWrapper<BzAdmin> wrapper = new QueryWrapper<>();
//        wrapper.eq("username",username).eq("password",password);
//        if(adminService.getOne(wrapper)==null){
//            return R.error();
//        }
//        if (adminService.getOne(wrapper).getStatus()==0){
//            return R.ok(null);
//        }else {
//            return R.error();
//        }
//    }
}

